<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<title>批发订单表</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="../../res/css/layui.css" media="all">
<link rel="stylesheet" href="../../res/css/cst/snproduction.css" media="all">
<link rel="stylesheet" type="text/css" href="../../res/css/sweetalert.css"/>
<script src="../../res/js/sweetalert.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="../../res/js/jquery-1.11.2.min.js"></script>
</head>
<body>
	<div class="demoTable" style="margin-left: 20px; margin-top: 10px;">
		操作人:
		<div class="layui-inline">
			<input class="layui-input" maxlength="8" style="height: 32px;" id="oper" autocomplete="off">
		</div>
		 &nbsp;&nbsp;&nbsp;&nbsp;批发时间：
		<div class="layui-inline">
			<input class="layui-input" style="height: 32px;" name="id" id="date" placeholder="yyyy-MM-dd"  autocomplete="off">
		</div>
		—
		<div class="layui-inline">
			<input class="layui-input" name="id" id="time" style="height: 32px;" placeholder="yyyy-MM-dd"  autocomplete="off">
		</div>
		&nbsp;&nbsp;&nbsp;&nbsp;订单状态:
		<from class="layui-form">
			<div class="layui-inline" style="width: 150px;">
				<select lay-filter="shenhe" id="state" >
					<option value="">请选择</option>
					<option value="1">批发等待审核</option>
					<option value="2">批发审核通过</option>
					<option value="3">批发审核不通过</option>
					<option value="4">退货等待审核</option>
					<option value="5">退货审核通过</option>
					<option value="6">退货审核不通过</option>
				</select>
			</div>
		</from>
		&nbsp;&nbsp;<button class="layui-btn" data-type="reload">搜索</button>
		<button class="layui-btn layui-btn-danger" style='background:#FF5722;' id="insert">增加</button>
	</div>
	<table class="layui-table" lay-data="{ url:'../../wholeSale/findAll.action', page:true, id:'idTest'}" lay-filter="demo">
		<thead>
			<tr>
				<th lay-data="{field:'whId',width:180,align:'center'}">流水号</th>
				<th lay-data="{field:'oper',width:80, align:'center'}">操作人</th>
				<th lay-data="{field:'whCount',width:100,sort: true, align:'center'}">总数量</th>
				<th lay-data="{field:'whSum',width:100,sort: true, align:'center'}">总金额</th>
				<th lay-data="{field:'optime',width:170,sort: true, align:'center'}">批发时间</th>
				<th lay-data="{field:'whState',width:130,align:'center',templet:'#imgTpl'}">订单状态</th>
				<th lay-data="{fixed: 'right',align:'center',toolbar: '#barDemo', width:540,}">操作</th>
			</tr>
		</thead>
	</table>
<script type="text/javascript" id="imgTpl">
	 {{# if(d.whState == 1) { }}
     	<div style="font-weight:bold;">批发等待审核</div>
 	 {{# } else if(d.whState == 2){ }}
    	<div style="color:green;font-weight:bold;">批发审核通过</div>
    {{# } else if(d.whState == 3){ }}
    	<div style="color:red;font-weight:bold;">批发审核不通过</div>
    {{# } else if(d.whState == 4){ }}
    	<div style="font-weight:bold;">退货等待审核</div>
	 {{# } else if(d.whState == 5){ }}
		<div style="color:green;font-weight:bold;">退货审核通过</div>
	 {{# } else if(d.whState == 6){ }}
		<div style="color:red;font-weight:bold;">退货审核不通过</div>
	 {{# }}}
</script>
<script type="text/html" id="Image">
    <img style="width:30px;height:23px;" src="../../{{ d.comImage }}">
</script>
<script type="text/html" id="barDemo">
  	<a class="layui-btn layui-btn-xs" lay-event="detail">批发订单详情</a>
	 {{# if(d.whState == 1) { }}
		<button class="layui-btn layui-btn-xs layui-btn-disabled">批发审核详情</button>
     	<button class="layui-btn layui-btn-xs layui-btn-disabled">确认批发</button>
		<a class="layui-btn layui-btn-xs layui-btn-disabled">退货</a>
		<a class="layui-btn layui-btn-xs layui-btn-disabled">退货订单详情</a>
		<a class="layui-btn layui-btn-xs layui-btn-disabled">退货审核详情</a>
 	 {{# } else if(d.whState == 2){ }}
		<button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="shdetail">批发审核详情</button>
	 	{{# if(d.sort == 1) { }}
    		<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="quere">确认批发</button>
			<a class="layui-btn layui-btn-xs layui-btn-disabled">退货</a>
			<a class="layui-btn layui-btn-xs layui-btn-disabled">退货订单详情</a>
			<a class="layui-btn layui-btn-xs layui-btn-disabled">退货审核详情</a>
		{{# }else if(d.sort == 2){ }}
			<button class="layui-btn layui-btn-xs layui-btn-disabled">已批发</button>
			<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="refunds">退货</a>
			<a class="layui-btn layui-btn-xs layui-btn-disabled">退货订单详情</a>
			<a class="layui-btn layui-btn-xs layui-btn-disabled">退货审核详情</a>
 		{{# }}}
	 {{# } else if(d.whState == 3){ }}
		<button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="shdetail">批发审核详情</button>
		<button class="layui-btn layui-btn-xs layui-btn-disabled">确认批发</button>
		<a class="layui-btn layui-btn-xs layui-btn-disabled">退货</a>
		<a class="layui-btn layui-btn-xs layui-btn-disabled">退货订单详情</a>
		<a class="layui-btn layui-btn-xs layui-btn-disabled">退货审核详情</a>
	 {{# } else if(d.whState == 4){ }}
		<button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="shdetail">批发审核详情</button>
		<button class="layui-btn layui-btn-xs layui-btn-disabled">已批发</button>
		<a class="layui-btn layui-btn-xs layui-btn-disabled">等待审核</a>
		<a class="layui-btn layui-btn-xs" lay-event="thdetail">退货订单详情</a>
		<a class="layui-btn layui-btn-xs layui-btn-disabled">退货审核详情</a>
 	{{# } else if(d.whState == 5){ }}
		<button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="shdetail">批发审核详情</button>
		<button class="layui-btn layui-btn-xs layui-btn-disabled">已批发</button>
		{{# if(d.sort == 2) { }}
			<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="qurt">确认退货</a>
		{{# }else if(d.sort == 3){ }}
			<a class="layui-btn layui-btn-xs layui-btn-disabled">已退货</a>
		{{# }}}
		<a class="layui-btn layui-btn-xs " lay-event="thdetail">退货订单详情</a>
		<a class="layui-btn layui-btn-xs" lay-event="tuidetail">退货审核详情</a>
 	{{# } else if(d.whState == 6){ }}
		<button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="shdetail">批发审核详情</button>
		<button class="layui-btn layui-btn-xs layui-btn-disabled">已批发</button>
		<a class="layui-btn layui-btn-xs layui-btn-disabled">退货</a>
		<a class="layui-btn layui-btn-xs" lay-event="thdetail">退货订单详情</a>
		<a class="layui-btn layui-btn-xs" lay-event="tuidetail">退货审核详情</a>
	 {{# }}}
  
</script>
<script type="text/html" id="barDemo2">
  	<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="zj">加入订单</a>
</script>
<script type="text/html" id="barDemo3">
  		<input type="text" id="{{d.wdId}}" class='thnum' style="height:30px;border:0px;width:80px;" onkeyup="number(this)">
</script>
	<!-- 增加批发订单弹框 -->
	<div id="add" style="display: none;overflow-x:hidden;">
	<input type="hidden" id="comId">
		<table class="layui-table" style='text-align:center;'>
			<thead>
			    <tr>
					<th style='text-align:center;'>商品批次号</th>
					<th style='text-align:center;'>商品名称</th>
					<th style='text-align:center;'>商品单位</th>
					<th style='text-align:center;'>建议零售价</th>
					<th style='text-align:center;'>批发价</th>
					<th style='text-align:center;'>批发数量</th>
					<th style='text-align:center;'>小计</th>
					<th style='text-align:center;'>操作</th>
			    </tr>
			  </thead>
			  <tbody id="tbody" >
					
			  </tbody>	
		</table>
		<hr>
		<div>
			<button style="float:right;margin-right:200px;" class="layui-btn layui-btn-normal" id="submitButton">提交</button>
		</div>
		<div class="demoTable" style="overflow-x:hidden;margin-left: 20px;line-height:16px; margin-top: 20px; display:inline" >搜&nbsp;索：
			<div class="layui-inline">
				<input class="layui-input" id="snacks" maxlength="10" style="height: 34px;" placeholder="请输入零食名称" autocomplete="off">
			</div>
			
			<div class="layui-inline">
				<input class="layui-input" type="number" onKeyUp="this.value=this.value.replace(/\D/g,'')" style="height: 34px;" id="snacksNum" placeholder="请输入零食批发价" autocomplete="off" style="width: 100px;"/>
			</div>
			—
			<div class="layui-inline">
				<input class="layui-input" type="number" onKeyUp="this.value=this.value.replace(/\D/g,'')" style="height: 34px;" id="snacksNum2" placeholder="请输入零食批发价" autocomplete="off" style="width: 100px;"/>
			</div>
			
			<from class="layui-form">
				<div class="layui-inline" style="width:140px;">
					<select lay-filter="type" id="snacksType" style="max-height:60px;">
						<option value="">请选择</option>
					</select>
				</div>
			</from>
			<button style="margin-left:10px;" class="layui-btn" data-type="suwhdetail" id="selectButton">搜索</button>
			<span style="position:relative;right:50px;top:-25px;font-size:20px;font-weight:bold;float:right;color:#e02b41;">　合计：<font id="heji">0</font>￥</span>
		</div>
		<hr>
		<table class="layui-table" lay-data="{ url:'../../wholeSale/queryBraProduction.action', page:true, id:'test2'}" lay-filter="insCom">
			  <thead>
				<tr>
					<th lay-data="{field:'comId',align:'center'}">商品Id</th>
					<th lay-data="{field:'typeName',align:'center'}">商品类型</th>
					<th lay-data="{field:'comName', align:'center'}">商品名称</th>
					<th lay-data="{field:'comImage', align:'center',toolbar: '#Image'}">商品图片</th>
					<th lay-data="{field:'comUnit',width:90, align:'center'}">商品单位</th>
					<th lay-data="{field:'ciRetail',width:100,sort: true, align:'center'}">零售价</th>
					<th lay-data="{field:'ciTrade',width:100,sort: true, align:'center'}">批发价</th>
					<th lay-data="{field:'ciInventory',sort: true, align:'center'}">商品库存量</th>
					<th lay-data="{fixed: 'right',align:'center',toolbar: '#barDemo2'}">操作</th>
				</tr>
			</thead>
		</table>
		<script src="../../res/layui.all.js" charset="utf-8"></script>
	</div>
	<!-- 退货的弹框 -->
	<div id="tui" style="display: none;overflow-x:hidden;">
		<input type="hidden" id="thdd">
		<div>
			<button style="float:right;position:relative;left:-100px;bottom:-4px;" class="layui-btn layui-btn-normal" id="submitButton2">立即提交</button>
			<input type="text" id="result" placeholder="请输入退货原因" maxlength="30" style="margin-left:20px;margin-top:5px;height:30px;width:300px;"/>
		</div>
		<hr>
		<table class="layui-table" lay-data="{ url:'../../suWhDetail/findAll.action', page:true, id:'test3'}" lay-filter="tHuo">
			  <thead>
				<tr>
					<th lay-data="{field:'wdId', align:'center'}">商品批次号</th>
					<th lay-data="{field:'comName', align:'center'}">商品名称</th>
					<th lay-data="{field:'comUnit', align:'center'}">商品单位</th>
					<th lay-data="{field:'wdMoney', align:'center'}">商品批发价</th>
					<th lay-data="{field:'wdNumber', align:'center'}">商品总数量</th>
					<th lay-data="{toolbar:'#barDemo3'}">退货数量</th>
				</tr>
			</thead>
		</table>
		<script src="../../res/layui.all.js" charset="utf-8"></script>
	</div>
	<script type="text/javascript" src="../../res/js/zyf/wholeSale.js"></script>
</body>
</html>